import Vue from 'vue';
import VueRouter from 'vue-router';
import Index from './components/index.vue';
import Add from './components/add.vue';
import Edit from './components/edit.vue';
import axios from "axios";

Vue.use(VueRouter);

// 将axios挂载在Vue实例原型上
Vue.prototype.$axios = axios;
// 超时终止请求
axios.defaults.timeout = 5000;
axios.defaults.baseURL = 'http://127.0.0.1:8000/app';
// 设置请求头
axios.defaults.headers = {'Content-type': 'application/json;charset=UTF-8'};

const router = new VueRouter({
    routes : [
        {path:'/',name:'Index',component:Index},
        {path:"/add",name:'Add',component:Add},
        {path:"/edit",name:'Edit',component:Edit}
    ]
});

new Vue({
    router,
    render: h => h(Index)
}).$mount("#app");
